//
//  Home_CollectionViewCellFunction.m
//  EggSteward
//
//  Created by 王道林 on 16/8/30.
//  Copyright © 2016年 王道林. All rights reserved.
//

#import "Home_CollectionViewCellFunction.h"

#import "Masonry.h"
@interface Home_CollectionViewCellFunction ()

@end

@implementation Home_CollectionViewCellFunction

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
    }
    return self;
}


- (void)createSubView
{
    _iamgeView = [[UIImageView alloc] init];
    [self.contentView addSubview:_iamgeView];
    _label = [[BaseLabel alloc] init];
    _label.textAlignment = 1;
    _label.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:_label];
}


- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    [_iamgeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.contentView.mas_left).offset(10);
        make.right.mas_equalTo(self.contentView.mas_right).offset(-10);
        make.top.mas_equalTo(self.contentView.mas_top).offset(10);
        make.bottom.mas_equalTo(self.contentView.mas_bottom).offset(-30);
    }];
    
    [_label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.contentView.mas_left).offset(10);
        make.right.mas_equalTo(self.contentView.mas_right).offset(-10);
        make.top.mas_equalTo(_iamgeView.mas_bottom).offset(5);
        make.bottom.mas_equalTo(self.contentView.mas_bottom).offset(-3);
    }];
}




@end
